namespace ts7 {


    function error(message: string): never {
        throw new Error(message);
    }
    function loop(): never {
        while (true) { }
    }


    //never 与 void 的差异

    function Void(): void {
        console.log('void')
    }
    Void()
    function never(): never {
        throw new Error('aaa')
    }
    never()


    interface A1 {
        type: 'foo'
    }
    interface B1 {
        type: 'bar'
    }
    interface C1 {
        type: 'bizz'
    }
    type All = A1 | B1 | C1
    function hadleValue(val: All) {
        switch (val.type) {
            case 'foo':
                break;
            case 'bar':
                break;
            case 'bizz':
                break;
            default:
                const exhaustiveCheck: never = val;
                break;
        }
    }
}

